package com.zyf.project.capchain.utils.common;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author Zhou Yifan
 */
public class IpUtils {

    private IpUtils() {}

    /**
     * 获取本机 ip
     *
     * @return 本机ip
     */
    public static String getLocalIp() {
        try {
            InetAddress ip4 = InetAddress.getLocalHost();
            return ip4.getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return "";
    }

}
